﻿#include "cadreoverviewtab.h"
#include "ui_cadreoverviewtab.h"
#include <QSqlRecord>
#include <QSqlQueryModel>
#include <QPixmap>
#include <QByteArray>
#include <QDebug>
#include <QDate>
#include <QFile>
#include "cadreutil.h"

CadreOverviewTab::CadreOverviewTab(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::CadreOverviewTab)
{
    ui->setupUi(this);
    sexHash.insert("1",QString::fromUtf8("男"));
    sexHash.insert("0",QString::fromUtf8("女"));

    yesnoHash.insert("1",QString::fromUtf8("是"));
    yesnoHash.insert("0",QString::fromUtf8("否"));
}

CadreOverviewTab::~CadreOverviewTab()
{
    delete ui;
}
void CadreOverviewTab::initOverviewTab(QString curperson)
{
    model = new QSqlQueryModel();
    model->setQuery(QString("SELECT `CadreName`, `IDNum`, `Birth`, `JoinWorkTime`, `Sex`, "
                        "`Health`, nationc.`Nation`, area.`AdminArea`, `PartyTime`, `Speciality`, "
                        "`Photo` FROM ZZB.CadreInfo ci "
                        "left join ZZB.NationCode nationc on nationc.`NationID`=ci.`NationID` "
                        "left join ZZB.AdminAreaCode area on area.`AdminAreaID`=ci.`NativePlace` "
                        "where IDNum = %1;").arg(curperson));
    QSqlRecord data = model->record(0);
    ui->nameLineEdit->setText(data.value("CadreName").toString());
    ui->sexLineEdit->setText(sexHash[data.value("Sex").toString()]);
    ui->birthLineEdit->setText(data.value("Birth").toString());
    ui->nationLineEdit->setText(data.value("Nation").toString());
    ui->nativeplaceLineEdit->setText(data.value("AdminArea").toString());
    ui->partytimeLineEdit->setText(data.value("PartyTime").toString());
    ui->worktimeLineEdit->setText(data.value("JoinWorkTime").toString());
    ui->healthLineEdit->setText(data.value("Health").toString());
    ui->specialityLineEdit->setText(data.value("Speciality").toString());
    // 照片
    QPixmap photo;
    QByteArray dbphoto = data.value("photo").toByteArray();
    bool load =photo.loadFromData(dbphoto);
    if(load){
        ui->photoLabel->setPixmap(photo.scaled(280, 202,
                                 Qt::KeepAspectRatio,
                                 Qt::SmoothTransformation));
    }else{
        ui->photoLabel->clear();
        ui->photoLabel->setText(QString::fromUtf8("暂无照片"));
    }

    // 学历
    QSqlQueryModel *eduModel = new QSqlQueryModel(this);
    QString sqlstring = QString("SELECT  educode.`Education`, degreecd.`Degree`,`School`, "
               "`Major`, `WorkORSchool` FROM Edu "
               "left join EducationCode educode on educode.`EducationID`= Edu.`EduName` "
               "left join DegreeCode degreecd on degreecd.`DegreeID`= Edu.`AcademicDe` "
               "where `IDNum` = %1").arg(curperson);
    eduModel->setQuery(sqlstring);
    int educount = eduModel->rowCount();
    if(educount>0){
        QStringList degreeList,eduList;
        degreeList << trUtf8("博士") <<trUtf8("硕士")<<trUtf8("学士")<<trUtf8("无");
        eduList<< trUtf8("博士研究生") <<trUtf8("硕士研究生")<<trUtf8("研究生")
               <<trUtf8("大学本科")<<trUtf8("大学专科")<<trUtf8("高中")
               <<trUtf8("技工")<<trUtf8("中等师范")<<trUtf8("中等专科");
        QString eduname,academi;
        // int：record中的序号；int：eduList中的序号；(序号小的则说明学历比较高)
        QHash<int,int> eduHash,degreeHash;
        QHash<int,int> workeduHash,workdegreeHash;
        for(int i=0;i<educount;i++){
            eduname = eduModel->record(i).value("Education").toString();
            academi =  eduModel->record(i).value("Degree").toString();
            if(eduModel->record(i).value("WorkORSchool")==1){
                // 如果有特殊情况不再上述所列，也可取到值
                ui->eduLineEdit->setText(eduname);
                ui->degreeLineEdit->setText(academi);
                ui->schoolmajorLineEdit->setText(
                            eduModel->record(i).value("School").toString()
                            + "" +eduModel->record(i).value("Major").toString());
                foreach(QString degree, degreeList){
                    if(academi.contains(degree)){
                        int index= degreeList.indexOf(degree);
                        degreeHash[i]= index;
                        break;
                    }
                }
                foreach(QString edu, eduList){
                    if(eduname.contains(edu)){
                        int index= eduList.indexOf(edu);
                        eduHash[i]=index;
                        break;
                    }
                }

            }else if(eduModel->record(i).value("WorkORSchool")==0){
                ui->workeduLineEdit->setText(eduname);
                ui->workdegreeLineEdit->setText(academi);
                ui->workschoolmajorLineEdit->setText(
                            eduModel->record(i).value("School").toString()
                            + "" +eduModel->record(i).value("Major").toString());
                foreach(QString degree, degreeList){
                    if(academi.contains(degree)){
                        int index= degreeList.indexOf(degree);
                        workdegreeHash[i]= index;
                        break;
                    }
                }
                foreach(QString edu, eduList){
                    if(eduname.contains(edu)){
                        int index= eduList.indexOf(edu);
                        workeduHash[i]=index;
                        break;
                    }
                }

            }
        }

        int eduri=CadreUtil::getMinValueFromHash(eduHash);
        int degreeri=CadreUtil::getMinValueFromHash(degreeHash);
        ui->eduLineEdit->setText(eduModel->record(eduri).value("Education").toString());
        ui->degreeLineEdit->setText(eduModel->record(degreeri).value("Degree").toString());
        // 学校与专业对应最高学历的学校及专业
        ui->schoolmajorLineEdit->setText(
                    eduModel->record(eduri).value("School").toString()
                    + "" +eduModel->record(eduri).value("Major").toString());

        int weduri=CadreUtil::getMinValueFromHash(workeduHash);
        int wdegreeri=CadreUtil::getMinValueFromHash(workdegreeHash);
        ui->workeduLineEdit->setText(eduModel->record(weduri).value("Education").toString());
        ui->workdegreeLineEdit->setText(eduModel->record(wdegreeri).value("Degree").toString());
        // 学校与专业对应最高学历的学校及专业
        ui->workschoolmajorLineEdit->setText(
                    eduModel->record(weduri).value("School").toString()
                    + "" +eduModel->record(weduri).value("Major").toString());

     }else{
        ui->eduLineEdit->clear();
        ui->degreeLineEdit->clear();
        ui->schoolmajorLineEdit->clear();
        ui->workeduLineEdit->clear();
        ui->workdegreeLineEdit->clear();
        ui->workschoolmajorLineEdit->clear();
    }
    // 职称
    QSqlQueryModel *titleModel = new QSqlQueryModel(this);
    titleModel->setQuery(QString("SELECT `TitleType`,`TitleLevel`,`TitleGetTime` FROM Title "
                         "where `IDNum`= %1 "
                         "and `TitleGetTime` = ( SELECT max(`TitleGetTime`) "
                          "FROM Title where `IDNum`= %2 );").arg(curperson,curperson));

    if(titleModel->rowCount()>0){
        QSqlRecord titledata = titleModel->record(0); //只有一行数据
        ui->titletypeLineEdit->setText(titledata.value("TitleType").toString());
        ui->titlelevelLineEdit->setText(titledata.value("TitleLevel").toString());
        ui->titlegettimeLineEdit->setText(titledata.value("TitleGetTime").toString());
    }else{
        ui->titletypeLineEdit->clear();
        ui->titlelevelLineEdit->clear();
        ui->titlegettimeLineEdit->clear();
    }
    // 现任职务
    QSqlQueryModel *postModel = new QSqlQueryModel();
    postModel->setQuery(QString("SELECT `PostName` FROM Post "
                                "where `IDNum` = %1 and QualifyType='0'").arg(curperson));

    if(postModel->rowCount()>0){
        QStringList post;
        for(int i=0;i<postModel->rowCount();i++){
            post << postModel->record(i).value("PostName").toString();
        }
        ui->postLineEdit->setText(post.join(QString(";")));
    }else{
        ui->postLineEdit->clear();
    }

    // 简历：工作经历
    QSqlQueryModel *experModel = new QSqlQueryModel();
    experModel->setQuery(QString("SELECT `ExperID`, `StartTime`, `EndTime`, `UnitName`, `PostName` "
                                "from Experience where `IDNum` = %1 ").arg(curperson));
    if(experModel->rowCount()>0){
        QStringList q;
        for(int i=0;i<experModel->rowCount();i++){
            QString start = experModel->record(i).value("StartTime").toDate().toString("yyyy.MM.dd");
            QString end = experModel->record(i).value("EndTime").toDate().toString("yyyy.MM.dd");
            QString unit = experModel->record(i).value("UnitName").toString();
            QString post = experModel->record(i).value("PostName").toString();
            start = !start.isEmpty()&&!start.isNull()? start:"xxxx.xx.xx";
            end = !end.isEmpty()&&!end.isNull()? end: "xxxx.xx.xx";
            q<< start+ " - "+ end + "\t"+ unit + "\t" + post;
        }
        ui->experiencetextEdit->setPlainText(q.join("\r\n"));
    }else
        ui->experiencetextEdit->clear();

    // 奖惩情况
    QSqlQueryModel *rewardModel = new QSqlQueryModel();
    rewardModel->setQuery(QString("SELECT `RewardNum`, `RewardTime`, `RewardType`, `RewardName`, "
                                  "`RewardLevel`, `RewardRanking` "
                                  "from Reward where `IDNum` = %1 ").arg(curperson));
    QSqlQueryModel *punishModel = new QSqlQueryModel();
    punishModel->setQuery(QString("SELECT `PunishNum`, `PunishTime`,  p.`PunishType`, `DeclareAgen`, "
                                  "`PunishName`, `PunishReason` "
                                  "from Punish "
                                  "left join PunishTypeContrast p on p.`PunishTypeID`= Punish.`PunishTypeID` "
                                  "where `IDNum` = %1 ").arg(curperson));

    if(rewardModel->rowCount()>0 || punishModel->rowCount()>0){
        QStringList rp;
        for(int i=0;i<rewardModel->rowCount();i++){
            if(i==0){
                rp<<QString::fromUtf8("奖励：");
            }
            QString time = rewardModel->record(i).value("RewardTime").toString();
            QString type = rewardModel->record(i).value("RewardType").toString();
            QString name = rewardModel->record(i).value("RewardName").toString();
            time = !time.isEmpty()? time:"xxxx-xx-xx";
            rp << time + "\t" + type + "\t" + name;
        }
        for(int j=0;j<punishModel->rowCount();j++){
            if(j==0){
                rp<<QString::fromUtf8("惩处：");
            }
            QString ptime = punishModel->record(j).value("PunishTime").toString();
            QString ptype = punishModel->record(j).value("PunishType").toString();
            QString pname = punishModel->record(j).value("PunishName").toString();
            QString preason = punishModel->record(j).value("PunishReason").toString();
            ptime = !ptime.isEmpty()? ptime:"xxxx-xx-xx";
            rp << ptime +"\t" + ptype + "\t" +pname + "\t"+preason;
        }
        ui->rewardpunishTextEdit->setPlainText(rp.join("\r\n"));
    }else{
        ui->rewardpunishTextEdit->clear();
    }
    // 年底考核
    QSqlQueryModel *checkModel = new QSqlQueryModel();
    checkModel->setQuery(QString("SELECT `CheckID`, `CheckYear`, `CheckResult`, `IDNum`, `CheckItem`, "
                                  "`CheckContent` from `Check` "
                                  "where `IDNum` = %1 ").arg(curperson));
    if(checkModel->rowCount()>0){
        QStringList q;
        for(int i=0;i<checkModel->rowCount();i++){
            QString year = checkModel->record(i).value("CheckYear").toString();
            QString result = checkModel->record(i).value("CheckResult").toString();
            q<< year+ "\t"+ result;
        }
        ui->checkTextEdit->setPlainText(q.join("\r\n"));
    }else
        ui->checkTextEdit->clear();

    // 家庭情况
    familyModel = new QSqlQueryModel();
    familyModel->setQuery(QString("SELECT `FamilyID`, `Name`, `BirthTime`, rc.`Relation`, `Politic`, `UnitName`, "
                                  "`Profession`, `IDNum`, `FamilyNum`, `FileRecRmk` "
                                  "FROM Family f "
                                  "left join RelationCode rc on rc.`RelationID`= f.`Relation` "
                                  "where `IDNum` = %1 ").arg(curperson));
    if(familyModel->rowCount()>0){
        QStringList q;
        for(int i=0;i<familyModel->rowCount();i++){
            QString relation = familyModel->record(i).value("Relation").toString();
            QString name = familyModel->record(i).value("Name").toString();
            QString politic= familyModel->record(i).value("Politic").toString();
            QString funit = familyModel->record(i).value("UnitName").toString();
            QString profession = familyModel->record(i).value("Profession").toString();
            q<< relation+ "\t"+ name + "\t" + politic + "\t" + funit+" "+profession;
        }
        ui->familyTextEdit->setPlainText(q.join("\r\n"));
    }else
        ui->familyTextEdit->clear();

}

QString CadreOverviewTab::saveHtmlToPDF()
{
    QDate birthday=QDate::fromString(ui->birthLineEdit->text(),"yyyy-MM-dd");
    int age=0;
    qDebug()<< birthday;
    if(birthday!=QDate()){
        QDate current= QDate::currentDate();
        int days =birthday.daysTo(current);
        age = days/365;
    }
    qDebug()<< age;
    QString iage;
    if (age==0) {
        iage=QString();
    }else if(age>0){
        iage = QString::number(age)+QString::fromUtf8("岁");
    }
    // 照片
    QPixmap photo;
    QByteArray dbphoto = model->record(0).value("photo").toByteArray();
    photo.loadFromData(dbphoto);
    QString imgsrc = "\home\download.jpg";    // 根据实际情况修改
    QFile file(imgsrc);
    file.open(QIODevice::WriteOnly);
    photo.save(&file, "JPG");

    QString html = "";
    html += "<html>";
    html += "<head>";
    html += "<title>"+QString::fromUtf8("干部信息导出PDF文档")+"</title>";
    html += "</head>";
    html += "<body>";
    html += "<h1 align=\"center\">"+QString::fromUtf8("干部任免审核表")+"</h1>";
    html += "<table width=\"100%\" border=\"1\" cellspacing=\"1\" cellpadding=\"4\" align=\"center\">";
    html += "<tr><td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("姓名")+"</td>"
            "<td align=\"center\" valign=\"middle\">"+ ui->nameLineEdit->text() +"</td>"
            "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("性别")+"</td>"
            "<td align=\"center\" valign=\"middle\">"+ ui->sexLineEdit->text() +"</td>"
            "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("出生年月（岁）")+" </td>"
            "<td align=\"center\" valign=\"middle\">"+ ui->birthLineEdit->text() +"<br/>"+iage+"</td>"
            "<td rowspan=\"4\" align=\"center\" valign=\"middle\"> "
            "<img src="+imgsrc+" alt=\"picture\" width=\"100\" "
            "height=\"100\"/> </td> </tr>";
    html += "<tr><td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("民族")+" </td>"
            "<td align=\"center\" valign=\"middle\">"+ ui->nationLineEdit->text()+"</td>"
            "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("籍贯")+"</td>"
            "<td align=\"center\" valign=\"middle\">"+ ui->nativeplaceLineEdit->text()+"</td>"
            "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("出生地")+" </td> "
            "<td align=\"center\" valign=\"middle\">"+ ui->birthplaceLineEdit->text()+"</td>"
            "</tr>";
    html += "<tr><td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("入党时间")+" </td>"
            "<td align=\"center\" valign=\"middle\">"+ ui->partytimeLineEdit->text()+"</td>"
            "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("参加工作时间")+"</td> "
            "<td align=\"center\" valign=\"middle\">"+ ui->worktimeLineEdit->text()+"</td>"
            "<td align=\"center\" valign=\"middle\"> "+ QString::fromUtf8("健康状况")+"</td>  "
            "<td align=\"center\" valign=\"middle\">"+ ui->healthLineEdit->text()+"</td>"
            " </tr>";
    html += "<tr><td align=\"center\" valign=\"middle\"> "+ QString::fromUtf8("专业技术职务")+"</td>"
            " <td align=\"center\" valign=\"middle\" colspan=\"2\"> </td> "
            "<td align=\"center\" valign=\"middle\"> "+ QString::fromUtf8("熟悉专业有何特长")+"</td>"
            "<td colspan=\"2\">"+ ui->specialityLineEdit->text()+" </td>"
            " </tr>";
    html += "<tr><td align=\"center\" valign=\"middle\" rowspan=\"2\"> "+ QString::fromUtf8("学历学位")+"</td>"
            "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("全日制教育")+"</td>"
            "<td align=\"center\" valign=\"middle\" colspan=\"2\">"+ ui->eduLineEdit->text()+"<br/>"+ui->degreeLineEdit->text()+" </td>"
            "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("毕业院校系及专业")+" </td>"
            "<td align=\"center\" valign=\"middle\" colspan=\"2\">"+ui->schoolmajorLineEdit->text()+" </td> </tr>";
    html += "<tr><td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("在职教育")+" </td>"
            "<td align=\"center\" valign=\"middle\" colspan=\"2\">"+ ui->workeduLineEdit->text()+"<br/>"+ui->workdegreeLineEdit->text()+"</td>"
            "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("毕业院校系及专业")+"</td> "
            "<td align=\"center\" valign=\"middle\" colspan=\"2\">"+ui->workschoolmajorLineEdit->text()+"</td></tr>";
    html += "<tr><td align=\"center\" valign=\"middle\" colspan=\"2\">"+ QString::fromUtf8("现任职务")+" </td>"
            "<td align=\"center\" valign=\"middle\" colspan=\"5\">"+ui->postLineEdit->text()+"</td></tr>";
    html += "<tr><td align=\"center\" valign=\"middle\" colspan=\"2\"> "+ QString::fromUtf8("拟任职务")+"</td>"
            "<td align=\"center\" valign=\"middle\" colspan=\"5\"></td></tr>";
    html += "<tr><td align=\"center\" valign=\"middle\" colspan=\"2\">"+ QString::fromUtf8("拟免职务")+" </td>"
            "<td align=\"center\" valign=\"middle\" colspan=\"5\"></td></tr>";
    html += "<tr><td align=\"center\" valign=\"middle\" >"+ QString::fromUtf8("简历")+" </td>"
            "<td align=\"center\" valign=\"middle\" colspan=\"6\">"+ui->experiencetextEdit->toPlainText()+" </td></tr>";
    html += "<tr><td align=\"center\" valign=\"middle\" >"+ QString::fromUtf8("奖惩情况")+" </td>"
            "<td align=\"center\" valign=\"middle\" colspan=\"6\">"+ui->rewardpunishTextEdit->toPlainText()+" </td></tr>";
    html += "<tr><td align=\"center\" valign=\"middle\" >"+ QString::fromUtf8("年度考核结果")+" </td>"
            "<td align=\"center\" valign=\"middle\" colspan=\"6\">"+ui->checkTextEdit->toPlainText()+" </td></tr>";
    html += "<tr><td align=\"center\" valign=\"middle\" >"+ QString::fromUtf8("任免理由")+" </td>"
            "<td align=\"center\" valign=\"middle\" colspan=\"6\"> </td></tr>";

    if(familyModel->rowCount()>0){
        html += "<tr><td calign=\"center\" valign=\"middle\" rowspan="+QString::number(familyModel->rowCount()+1)+">"+ QString::fromUtf8("家庭主要成员及主要社会关系")+" </td>  "
                "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("称谓")+" </td>"
                "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("姓名")+" </td>"
                "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("出生日期")+" </td>"
                "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("政治面貌")+"</td>"
                "<td align=\"center\" valign=\"middle\" colspan=\"2\">"+ QString::fromUtf8("工作单位及职务")+" </td></tr>";
        for(int i=0;i<familyModel->rowCount();i++){
            QString relation = familyModel->record(i).value("Relation").toString();
            QString name = familyModel->record(i).value("Name").toString();
            QString birth = familyModel->record(i).value("BirthTime").toString();
            QString politic= familyModel->record(i).value("Politic").toString();
            QString funit = familyModel->record(i).value("UnitName").toString();
            QString profession = familyModel->record(i).value("Profession").toString();
            html += "<tr>"
                    "<td align=\"center\" valign=\"middle\">"+relation+"</td>"
                    "<td align=\"center\" valign=\"middle\">"+name+"</td>"
                    "<td align=\"center\" valign=\"middle\">"+birth+"</td>"
                    "<td align=\"center\" valign=\"middle\">"+politic+"</td>"
                    "<td align=\"center\" valign=\"middle\" colspan=\"2\">"+funit+"&nbsp;&nbsp;"+profession+"</td>"
                    "</tr>";
        }
    }else{
        html += "<tr><td calign=\"center\" valign=\"middle\" rowspan=\"5\">"+ QString::fromUtf8("家庭主要成员及主要社会关系")+" </td>  "
                "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("称谓")+" </td>"
                "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("姓名")+" </td>"
                "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("出生日期")+" </td>"
                "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("政治面貌")+"</td>"
                "<td align=\"center\" valign=\"middle\" colspan=\"2\">"+ QString::fromUtf8("工作单位及职务")+" </td></tr>";
        for(int i=0;i<4;i++){
            html += "<tr>"
                    "<td align=\"center\" valign=\"middle\"></td>"
                    "<td align=\"center\" valign=\"middle\"></td>"
                    "<td align=\"center\" valign=\"middle\"></td>"
                    "<td align=\"center\" valign=\"middle\"></td>"
                    "<td align=\"center\" valign=\"middle\" colspan=\"2\"></td>"
                    "</tr>";
        }
    }

    html += "<tr><td align=\"center\" valign=\"middle\" > "+ QString::fromUtf8("呈报单位")+"</td><td colspan=\"6\">"
            "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p></td></tr>";
    html += "<tr><td align=\"center\" valign=\"middle\" >"+ QString::fromUtf8("审批机关意见")+" </td>";
    html += "<td colspan=\"3\" align=\"left\" valign=\"top\">"
            "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>"
            "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>"
            "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>"
            "<p align=\"right\" valign=\"bottom\">("+ QString::fromUtf8("盖")+""
            "&nbsp;&nbsp;&nbsp;"+ QString::fromUtf8("章")+")</p>"
            "<p align=\"right\" valign=\"bottom\">"+ QString::fromUtf8("年")
            +"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
            ""+ QString::fromUtf8("月")+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
            ""+ QString::fromUtf8("日")+"</p></td>  ";
    html += "<td align=\"center\" valign=\"middle\">"+ QString::fromUtf8("行政机关任免意见")+" </td><td colspan=\"2\"> "
            "<p style=\"height:35%\"></p>"
            "<p align=\"right\" valign=\"bottom\">("+ QString::fromUtf8("盖")
            +"&nbsp;&nbsp;"+ QString::fromUtf8("章")+")</p>"
            "<p><span align=\"right\" valign=\"bottom\">&nbsp;&nbsp;&nbsp;&nbsp;"
            + QString::fromUtf8("年")+"&nbsp;&nbsp;&nbsp;&nbsp;"
            + QString::fromUtf8("月")+"&nbsp;&nbsp;&nbsp;&nbsp;"
            + QString::fromUtf8("日")+"</span></p></td>";
    html += "</tr>";
    html += "</table>";
    html += "</body>";
    html += "</html>";
    return html;
}
